home *** CD-ROM | disk | FTP | other *** search
/ ftp.cs.arizona.edu / ftp.cs.arizona.edu.tar / ftp.cs.arizona.edu / icon / newsgrp / group00b.txt / 000131_icon-group-sender_Tue Oct 31 08:51:18 2000.msg < prev    next >
Internet Message Format  |  2001-01-03  |  2KB

  1. Return-Path: <icon-group-sender>
  2. Received: (from root@localhost)
  3.     by baskerville.CS.Arizona.EDU (8.11.1/8.11.1) id e9VFlGd29386
  4.     for icon-group-addresses; Tue, 31 Oct 2000 08:47:16 -0700 (MST)
  5. Message-Id: <200010311547.e9VFlGd29386@baskerville.CS.Arizona.EDU>
  6. From: Nevin Liber <nevin@spies.com>
  7. Subject: Re: How would the experts handle this...??
  8. To: symbiot@my-deja.com
  9. Date: Mon, 30 Oct 2000 15:36:44 -0800 (PST)
  10. Cc: icon-group@cs.arizona.edu
  11. Errors-To: icon-group-errors@cs.arizona.edu
  12. Status: RO
  13. Content-Length: 1539
  14.  
  15. symbiot@my-deja.com wrote:
  16.  
  17. > I wish to scan thru a file and determine how letters "connect" with one
  18. > another. By that I mean that for every letter of the alphabet, I would
  19. > like to compile two lists: one containing all the letters which apper
  20. > to the right of the given letter, and another for all those appearing
  21. > to the left.
  22.  
  23. My first pass (I'm doing it only on one string; a little more work
  24. is needed to have this work on a whole file, sort the output, etc.)
  25. would be something like:
  26.  
  27.  
  28.     procedure Connect(s)
  29.  
  30.         local    TLeft
  31.         local    TRight
  32.         local    sRight
  33.         local    sMiddle
  34.         local    sLeft
  35.  
  36.         TLeft := table('')
  37.         TRight := table('')
  38.  
  39.         s ? {
  40.             sRight := move(1)
  41.             while sMiddle := \sRight do {
  42.                 sRight := move(1) | &null
  43.                 TLeft[sMiddle] ++:= \sLeft
  44.                 TRight[sMiddle] ++:= \sRight
  45.                 sLeft := sMiddle
  46.             }        
  47.         }
  48.  
  49.         write(image(s))
  50.         write("Left")
  51.         every sMiddle := key(TLeft) do
  52.             write(image(sMiddle), "\t", image(TLeft[sMiddle]))
  53.         write()
  54.         write("Right")
  55.         every sMiddle := key(TRight) do
  56.             write(image(sMiddle), "\t", image(TRight[sMiddle]))
  57.  
  58.     end
  59.  
  60.  
  61. > "Cable television programming is...."
  62.  
  63. My output would be:
  64.  
  65. "Cable television programming is..."
  66. Left
  67. "s"    'i'
  68. " "    'egn'
  69. "p"    ' '
  70. "e"    'lt'
  71. "m"    'am'
  72. "b"    'a'
  73. "r"    'gp'
  74. "g"    'no'
  75. "o"    'ir'
  76. "l"    'be'
  77. "t"    ' '
  78. "a"    'Cr'
  79. "i"    ' msv'
  80. "."    '.s'
  81. "n"    'io'
  82. "v"    'e'
  83.  
  84. Right
  85. "C"    'a'
  86. "s"    '.i'
  87. " "    'ipt'
  88. "p"    'r'
  89. "e"    ' lv'
  90. "m"    'im'
  91. "b"    'l'
  92. "r"    'ao'
  93. "g"    ' r'
  94. "o"    'gn'
  95. "l"    'e'
  96. "t"    'e'
  97. "a"    'bm'
  98. "i"    'nos'
  99. "."    '.'
  100. "n"    ' g'
  101. "v"    'i'
  102. -- 
  103.  Nevin ":-)" Liber    <mailto:nevin@spies.com>    (773) 961-2479
  104.